home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
libs
/
ctask22d
/
minres.asm
< prev
next >
Wrap
Assembly Source File
|
1990-10-12
|
2KB
|
89 lines
.model large,c
dosseg
;
include tsk.mac
;
; This is a sample for a minimal program that makes the
; CTask kernel resident.
;
public _acrtused
public _psp
public alloc_resource
;
Pubfunc tsk_alloc
Pubfunc tsk_free
;
Globext install_tasker
Globext preempt_on
Globext set_priority
Globext schedule
;
_acrtused equ 9876h
;
NULL segment para public 'BEGDATA'
NULL ends
;
stacklen = 256
;
.stack stacklen
;
.data?
;
alloc_resource resource <>
;
_psp dw ?
;
.data
;
main_name db "CTRES",0
;
.code
;
; Dummy allocation routines. The memory allocation is never called
; by CTask if you don't explicitly request it.
;
tsk_free:
tsk_alloc:
xor ax,ax
mov dx,ax
ret
;
; The main program.
; NOTE: This sample program does *not* clear uninitialized memory
; to zero. CTask has explicit initialization code for all
; of it's variables.
;
main:
mov ax,@data
mov ds,ax
mov _psp,es
cld
mov ax,es:[2ch] ; Environment pointer in PSP
mov es,ax
mov ah,49h ; Release environment
int 21h
;
; install_tasker (0, 0, IFL_DISK | IFL_PRINTER | IFL_INT15);
;
ifls = IFL_DISK OR IFL_PRINTER OR IFL_INT15
callp install_tasker,<0,0,ifls,<ds,#main_name>>
;
; set_priority (NULL, PRI_STD);
;
callp set_priority,<<0,0>,PRI_STD>
;
call preempt_on
call schedule
;
mov dx,offset STACK ; stack end
add dx,15 ; round up
mov cl,4
shr dx,cl ; convert to paragraphs
add dx,@data ; add data start segment
sub dx,_psp ; minus program segment
mov ax,3100h ; TSR
int 21h
;
end main